<!--Copyright (C) Kherty.  All rights reserved.-->
<oui:GroupPanel
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    x:Class="OpenLS.Spreadsheet.UI.FormulaTabContent"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:oui="http://schemas.Kherty.com/office/2007"
    xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI"
    xmlns:ss="http://schemas.Kherty.com/office/2007/spreadsheet"
    xmlns:ssFunctions="clr-namespace:OpenLS.Spreadsheet.Functions;assembly=OpenLS.Spreadsheet"
    xmlns:Internals="clr-namespace:OpenLS.Spreadsheet.UI.Internals"
    xmlns:media="clr-namespace:OpenLS.Media;assembly=OpenLS.Media"
    xmlns:Resources="clr-namespace:OpenLS.Spreadsheet.UI.Internals.Resources">
        <oui:Group Header="{x:Static Resources:UIStringTable.FunctionLibrary}" MediumStatePriority="100">
            <Menu oui:RibbonElement.MediumGroupStyle="{x:Static oui:RibbonElement.MediumControlStyle}">
                <Menu.Resources>
                    <DataTemplate DataType="{x:Type ssFunctions:Function}">
                        <TextBlock Text ="{Binding Name}"/>
                    </DataTemplate>
                    <DataTemplate DataType="{x:Type ssFunctions:AddInFunction}">
                        <TextBlock Text ="{Binding LocalizedName}"/>
                    </DataTemplate>
                    <Style TargetType="{x:Type MenuItem}" x:Key="ics2" BasedOn="{StaticResource {x:Type MenuItem}}">
                        <Setter Property="Command" Value="{x:Static ssui:SpreadsheetCommands.InsertFunction}"/>
                        <Setter Property="CommandParameter" Value="{Binding Header, RelativeSource={RelativeSource Self}}"/>
                        <Setter Property="oui:RibbonElement.Icon" Value="{x:Null}">
                        </Setter>
                    </Style>
                    <Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource {x:Type MenuItem}}">
                        <Setter Property="Command" Value="{x:Static ssui:SpreadsheetCommands.InsertFunction}"/>
                        <Setter Property="CommandParameter" Value="{Binding Header, RelativeSource={RelativeSource Self}}"/>
                        <Setter Property="ItemContainerStyle" Value="{StaticResource ics2}"/>
                        <Setter Property="oui:RibbonElement.Icon" Value="{x:Null}">
                            <!--                    <Setter.Value>
                      <MultiBinding Converter="{StaticResource imageNoSizeConverter}">
                        <Binding Path="Command" RelativeSource="{RelativeSource Self}"/
                        <Binding Path="(oui:OfficeElement.IconProvider)" RelativeSource="{RelativeSource Self}"/
                      </MultiBinding>
                    </Setter.Value> -->
                        </Setter>

                    </Style>
                </Menu.Resources>
                <MenuItem Header="{Binding Source={x:Static ssui:SpreadsheetCommands.InsertFunction}, Path=Text}" CommandParameter="{x:Null}" oui:RibbonElement.MediumGroupStyle="{x:Static oui:RibbonElement.LargeControlStyle}">
                    <MenuItem.Icon>
                        <TextBlock FontFamily ="Bodoni MT" FontSize="28" Text="fx" Foreground="Black" FontWeight="Bold" FontStyle="Italic" FontStretch="Condensed"/>
                </MenuItem.Icon>
                </MenuItem>
                <MenuItem Header="{Binding Source={x:Static Resources:UIStringTable.AutoSum}, Path=Text}" Command="{x:Static ssui:SpreadsheetCommands.AutoSum}" CommandParameter="SUM" >
                    <MenuItem.Icon>
                        <TextBlock Text="S" FontFamily="Symbol" FontSize="28" FontWeight="Bold" />
                </MenuItem.Icon>
                    <MenuItem Header="{x:Static Resources:UIStringTable.Sum}"  Command="{x:Static ssui:SpreadsheetCommands.AutoSum}" >
                        <MenuItem.Icon>
                            <TextBlock FontFamily="Symbol" FontWeight="UltraBold"  Width="16" Height="16">S</TextBlock>
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Header="{x:Static Resources:UIStringTable.Average}"  Command="{x:Static ssui:SpreadsheetCommands.AutoSum}" CommandParameter="AVERAGE" />
                    <MenuItem Header="{x:Static Resources:UIStringTable.CountNumber}"  Command="{x:Static ssui:SpreadsheetCommands.AutoSum}" CommandParameter="COUNT" />
                    <MenuItem Header="{x:Static Resources:UIStringTable.Min}" Command="{x:Static ssui:SpreadsheetCommands.AutoSum}" CommandParameter="MIN" />
                    <MenuItem Header="{x:Static Resources:UIStringTable.Max}" Command="{x:Static ssui:SpreadsheetCommands.AutoSum}" CommandParameter="MAX" />
                </MenuItem>
                <MenuItem Command="{x:Null}" Header="{x:Static Resources:UIStringTable.RecentlyUsed}" Icon="{media:Image FunctionsRecentlyUsedtInsertGallery}">
                </MenuItem>
                <MenuItem Command="{x:Null}" Header="{x:Static Resources:UIStringTable.Financial}" ItemsSource="{x:Static ssFunctions:FunctionManager.FinancialFunctions}" Icon="{media:Image FunctionsFinancialInsertGallery}" >
                </MenuItem>
                <MenuItem Command="{x:Null}" Header="{x:Static Resources:UIStringTable.Logical}" ItemsSource="{x:Static ssFunctions:FunctionManager.LogicalFunctions}" Icon="{media:Image FunctionsLogicalInsertGallery}" >
                </MenuItem>
                <MenuItem Command="{x:Null}" Header="{x:Static Resources:UIStringTable.Text}" ItemsSource="{x:Static ssFunctions:FunctionManager.TextFunctions}"  Icon="{media:Image FunctionsTextInsertGallery}" >
                </MenuItem>
                <MenuItem Command="{x:Null}" Header="{x:Static Resources:UIStringTable.DateTime}" ItemsSource="{x:Static ssFunctions:FunctionManager.DateTimeFunctions}" Icon="{media:Image FunctionsDateTimeInsertGallery}" >
                </MenuItem>
                <MenuItem Command="{x:Null}" Header="{x:Static Resources:UIStringTable.LookupReference}" ItemsSource="{x:Static ssFunctions:FunctionManager.LookupReferenceFunctions}"  Icon="{media:Image FunctionsLookupReferenceInsertGallery}" >
                </MenuItem>
                <MenuItem Command="{x:Null}" Header="{x:Static Resources:UIStringTable.MathTrig}" ItemsSource="{x:Static ssFunctions:FunctionManager.MathFunctions}" Icon="{media:Image FunctionsMathTrigInsertGallery}" >
                </MenuItem>
                <MenuItem Command="{x:Null}" Header="{x:Static Resources:UIStringTable.MoreFunctions}" oui:RibbonElement.ControlState="Large"
                        oui:RibbonElement.MediumGroupStyle="{x:Static oui:RibbonElement.MediumControlStyle}" Icon="{media:Image FormulaMoreFunctionsMenu}" >
                    <MenuItem
                  Command="{x:Null}" 
                  Header="{x:Static Resources:UIStringTable.Statistical}"
                  ItemsSource="{x:Static ssFunctions:FunctionManager.StatisticalFunctions}"
                  oui:RibbonElement.ControlState="Small"  Icon="{media:Image FunctionsStatisticalInsertGallery}" >
                    </MenuItem>
                    <MenuItem Header="{x:Static Resources:UIStringTable.Engineering}" Command="{x:Null}"  ItemsSource="{x:Static ssFunctions:FunctionManager.EngineeringFunctions}" oui:RibbonElement.ControlState="Small" Icon="{media:Image FunctionsEngineeringInsertGallery}" />
                    <MenuItem Header="{x:Static Resources:UIStringTable.Information}" Command="{x:Null}" ItemsSource="{x:Static ssFunctions:FunctionManager.InformationFunctions}"  oui:RibbonElement.ControlState="Small" Icon="{media:Image FunctionsInformationInsertGallery}" >
                    </MenuItem>
                </MenuItem>
            </Menu>
        </oui:Group>
        <oui:Group Header="{x:Static Resources:UIStringTable.DefinedNames}">
            <Menu>
                <MenuItem Command="{x:Static ssui:SpreadsheetCommands.NameManager}" oui:RibbonElement.ControlState="Large"/>
                <MenuItem Command="{x:Static ssui:SpreadsheetCommands.DefineName}" oui:RibbonElement.ControlState="Small"/>
            </Menu>
        </oui:Group>
        <oui:Group Header="{x:Static Resources:UIStringTable.Calculation}">
            <StackPanel Orientation="Horizontal">
                <Menu>
                    <MenuItem
                Header="{x:Static Resources:UIStringTable.CalculationOptions}" Icon="{media:Image Calculator}">
                        <!-- missing icon-->
                        <MenuItem Header="{x:Static Resources:UIStringTable.Automatic}" Command="{x:Static ssui:SpreadsheetCommands.SetCalculationMode}" CommandParameter ="{x:Static ss:CalculationMode.Automatic}"/>
                        <MenuItem Header="{x:Static Resources:UIStringTable.AutomaticExceptForDataTables}" Command="{x:Static ssui:SpreadsheetCommands.SetCalculationMode}" CommandParameter ="{x:Static ss:CalculationMode.AutomaticNoTable}"/>
                        <MenuItem Header="{x:Static Resources:UIStringTable.Manual}" Command="{x:Static ssui:SpreadsheetCommands.SetCalculationMode}" CommandParameter ="{x:Static ss:CalculationMode.Manual}"/>

                    </MenuItem>
                </Menu>

                <Menu>
                    <MenuItem Command="{x:Static ssui:SpreadsheetCommands.CalculateWorkbook}"  oui:RibbonElement.ControlState="Medium"/>
                    <MenuItem Command="{x:Static ssui:SpreadsheetCommands.CalculateWorksheet}" oui:RibbonElement.ControlState="Medium"/>
                </Menu>
            </StackPanel>
        </oui:Group>
    </oui:GroupPanel>
